PixelBoi: The Game
Peter Chow | May 8 - June 5, 2020 | Unity | C#
Making a 2D game with the Unity game engine.
The Idea
After taking a computer science course during the Coronavirus pandemic of 2020, I decided I wanted to make a game because it was the next best course of action to use my newly learned skills and it has always been a dream of mine. So after a few hours of setting up and downloading Unity, I set my mind on making the game. I didn't have high expectations for this game because my main objective was to polish my skills with the Unity game engine platform. As I have no art skills, I used pixel art from the Unity asset store and itch.io to piece together the game. However, I hope to make my own game with game sprites and art that are made all by me. Nevertheless, I tried my best to make it a fun game!
The Learning Process
The game-making process was a hell of a journey of challenges. As a newbie with zero knowledge with the Unity game engine, it was especially hard to comprehend the various components, assets, and scripts. However, through the many youtube tutorials I watched, I learned that it essentially boils down to two things: the front-end and the back-end. The front-end is everything you can see or hear, such as the character sprites, music, background tiles, etc. The back-end is the character movement, scene changes, game functions such as character health, damage -- all of which are programmed using C#.
Game objects, an essential part of any game, are obviously objects within a game that holds onto multiple components. There are many built-in Unity components (collapsable sections on the right of the picture above) that control the object's physics (Rigidbody component), animation (Animator component), art (Sprite Renderer component), and many more. A script component is essentially a component with a C# file with all the necessary code that make the object perform an action (sort of like an instruction manual for an object). All Unity C# files inherit the Monobehaviour base class from Unity. The Monobehaviour API offers a diverse variety of methods that lets you do almost anything. You can reference scripts or components across all your game objects using the method in the code snippet below. Within a C# script, you can also set public float, string, int, bool values that can be altered on runtime. These values can also be altered with another C# script on another game object. The possibilities are endless!
Although I haven't made any original pixel art, I learned a bit about making pixel art using photoshop. I utilized the assets I found online and changed some pixels to get the desired effect I want. This includes changing the color of the pixels and adding/deleting pixels.
I also learned about parent and child elements within Unity. This is very similar to the idea of inheritance that I learned in AP Computer Science. This means that with a game object #1, it can be a parent or a child to another game object #2. If game object #1 is a child of game object #2, #1 will have its position relative to #2. Moving #2 would also move #1, but not the other way around.
Using Unity has also utilized my inherent micromanaging skills. With game development, micromanaging skills are essential as you have to account for everything. This even includes things that the player doesn't know about. I also stumbled upon Trello, a to-do board that helps you organize everything you have to do. This highly motivates me and makes sure I don't forget anything. As Trello is a fairly popular platform that professionals use, I had the opportunity to learn more about it.
The Challenges
The most challenging part was the leaderboards. This was VERY confusing as I used playfab, a back-end database without SQL that gets information from the game and sends it to the playfab database. This was pre-structured for games so it made it a lot easier, but it still wasn't easy enough. Playfab uses a series of method calls that send information to the database online and perform certain actions. The idea of a leaderboard would be to send the information to playfab.com and retrieving it on runtime (some sort of setuserleaderboard/getuserleaderboard method). However, the back-end part of playfab is currently out of my scope as the hard parts are pre-structured by Microsoft, but I hope to understand it one day!
A small challenge that stumped me for a while is how to publish the game online at school. Since school wifi blocks all kinds of games, I discovered a work around using Github pages. Since Github is not considered a game, I can share the game with my friends at school.
The Extensions
Some extensions I use for Unity and C# are: